Skip to content

feat(spp_demo): curated PHL geodata + spp_demo_phl_luzon demo module (re-land from #76)#277

Open
gonzalesedwin1123 wants to merge 4 commits into
19.0from
reland/phl-demo
Open

feat(spp_demo): curated PHL geodata + spp_demo_phl_luzon demo module (re-land from #76)#277
gonzalesedwin1123 wants to merge 4 commits into
19.0from
reland/phl-demo

Conversation

@gonzalesedwin1123

@gonzalesedwin1123 gonzalesedwin1123 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Re-lands the PHL demo-data portion of reverted PR #76 (revert: #271). Everything listed is contained in THIS PR's diff.

Summary

  • spp_demo: curated PHL shapes/areas (phl_curated.geojson, areas.xml) and demo generator updates.
  • New spp_demo_phl_luzon module: Luzon administrative areas, population weights, area loader (depends on spp_demo's loader changes).
  • scripts/prepare_phl_geodata.py: the script that generates the curated geodata.

Added on top of #76 (not in the original)

  • gemini-code-assist review findings, all applied: the Luzon area loader batch-fetches areas by code (removing a per-feature N+1 search over ~700 features); the streamed geodata download is wrapped in a context manager; usage docs list the pandas/openpyxl deps required for population weights (plus a ruff line-length wrap).
  • Version bump + HISTORY entry for spp_demo; README rendered from the updated fragment.

Verification

  • ./spp t spp_demo: 121 passed, 0 failed
  • ./spp t spp_demo_phl_luzon: 17 passed, 0 failed
  • codecov: patch pass
  • All gemini-code-assist threads resolved with fixing-commit references

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a geodata preparation script (prepare_phl_geodata.py) and updates the spp_demo module with refreshed Philippine geodata using PSA/HDX p-codes. It also introduces a new companion module, spp_demo_phl_luzon, which provides Luzon-scale demo areas, population weights, and an area loader. The review feedback highlights three key improvements: optimizing an N+1 query pattern in the Luzon area loader's shape-loading method, wrapping the streaming HTTP request in a context manager to prevent connection leaks, and updating the script's documented dependencies to include pandas and openpyxl so that population data processing does not silently fail.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread spp_demo_phl_luzon/models/area_loader.py
Comment thread scripts/prepare_phl_geodata.py Outdated
Comment thread scripts/prepare_phl_geodata.py Outdated
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.85714% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.94%. Comparing base (bf61488) to head (77a1aca).
⚠️ Report is 1 commits behind head on 19.0.

Files with missing lines Patch % Lines
spp_demo_phl_luzon/models/area_loader.py 84.53% 15 Missing ⚠️
spp_demo_phl_luzon/__manifest__.py 0.00% 1 Missing ⚠️
spp_demo_phl_luzon/models/population_weights.py 97.43% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             19.0     #277      +/-   ##
==========================================
- Coverage   74.86%   68.94%   -5.93%     
==========================================
  Files        1093      163     -930     
  Lines       63718    14244   -49474     
==========================================
- Hits        47701     9820   -37881     
+ Misses      16017     4424   -11593     
Flag Coverage Δ
endpoint_route_handler ?
fastapi ?
spp_aggregation ?
spp_alerts ?
spp_analytics ?
spp_api_v2 ?
spp_api_v2_change_request ?
spp_api_v2_cycles ?
spp_api_v2_data ?
spp_api_v2_entitlements ?
spp_api_v2_gis ?
spp_api_v2_products ?
spp_api_v2_programs ?
spp_api_v2_service_points ?
spp_api_v2_simulation ?
spp_api_v2_vocabulary ?
spp_approval ?
spp_area ?
spp_area_hdx ?
spp_attachment_av_scan ?
spp_audit ?
spp_audit_programs ?
spp_banking ?
spp_base_common 90.26% <ø> (ø)
spp_base_setting ?
spp_case_base ?
spp_case_cel ?
spp_case_demo 94.34% <ø> (ø)
spp_case_entitlements ?
spp_case_graduation ?
spp_case_programs ?
spp_case_registry ?
spp_case_session ?
spp_cel_domain ?
spp_cel_event ?
spp_cel_registry_search ?
spp_cel_vocabulary ?
spp_change_request_v2 ?
spp_claim_169 ?
spp_cr_type_assign_program ?
spp_cr_types_advanced ?
spp_cr_types_base ?
spp_dci ?
spp_dci_client ?
spp_dci_client_dr ?
spp_dci_client_ibr ?
spp_dci_client_sr ?
spp_dci_compliance ?
spp_dci_demo 69.23% <ø> (ø)
spp_dci_indicators ?
spp_dci_server ?
spp_dci_server_social ?
spp_demo 73.63% <ø> (+0.08%) ⬆️
spp_demo_phl_luzon 87.85% <87.85%> (+0.26%) ⬆️
spp_disability_registry ?
spp_drims ?
spp_drims_sl ?
spp_drims_sl_demo ?
spp_encryption ?
spp_farmer_registry ?
spp_farmer_registry_cr ?
spp_farmer_registry_demo 60.97% <ø> (+8.23%) ⬆️
spp_farmer_registry_vocabularies ?
spp_gis ?
spp_gis_indicators ?
spp_gis_report ?
spp_graduation ?
spp_grm ?
spp_grm_case_link ?
spp_grm_demo 81.16% <ø> (+1.29%) ⬆️
spp_hazard ?
spp_hazard_programs ?
spp_hxl_area ?
spp_import_match ?
spp_indicator ?
spp_irrigation ?
spp_land_record ?
spp_metric ?
spp_metric_service ?
spp_metrics_core ?
spp_metrics_services ?
spp_mis_demo_v2 70.44% <ø> (+2.51%) ⬆️
spp_oauth ?
spp_program_geofence ?
spp_programs 65.27% <ø> (ø)
spp_registrant_gis ?
spp_registry 86.83% <ø> (ø)
spp_registry_group_hierarchy ?
spp_scoring ?
spp_scoring_programs ?
spp_security 66.66% <ø> (ø)
spp_service_points ?
spp_simulation ?
spp_starter_disability_registry ?
spp_starter_farmer_registry ?
spp_starter_social_registry ?
spp_starter_sp_mis ?
spp_statistic ?
spp_storage_backend ?
spp_studio ?
spp_studio_change_requests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
spp_demo/__manifest__.py 0.00% <ø> (ø)
spp_demo/models/demo_data_generator.py 70.81% <ø> (+0.12%) ⬆️
spp_demo_phl_luzon/__init__.py 100.00% <100.00%> (ø)
spp_demo_phl_luzon/models/__init__.py 100.00% <100.00%> (ø)
spp_demo_phl_luzon/__manifest__.py 0.00% <0.00%> (ø)
spp_demo_phl_luzon/models/population_weights.py 97.43% <97.43%> (ø)
spp_demo_phl_luzon/models/area_loader.py 84.53% <84.53%> (+0.49%) ⬆️

... and 934 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

… module (from #76)

Re-lands the PHL demo data portion of reverted PR #76: curated PHL
geojson shapes and areas, demo data generator and area loader test
updates, the prepare_phl_geodata.py preparation script, and the new
spp_demo_phl_luzon module (Luzon demo areas + population weights).

Files restored verbatim from the pre-revert merged state (8bf9a3a).
spp_demo bumped to 19.0.2.1.0 with a HISTORY entry.
- area_loader: batch-fetch areas by code instead of per-feature search (N+1
  over ~700 Luzon features).
- prepare_phl_geodata.py: close streamed download via context manager; usage
  docs include pandas/openpyxl needed for population weights.
@gonzalesedwin1123

Copy link
Copy Markdown
Member Author

All three gemini-code-assist findings applied (commit 91c9e06): batched area lookup replacing the per-feature N+1 search, streamed download wrapped in a context manager, and usage docs now include pandas/openpyxl. ./spp t spp_demo_phl_luzon: 17/0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant